<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ECharts MarkPoint 示例</title>
    <script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
    <style>
        #main {
            width: 600px;
            height: 400px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <div id="main"></div>
    <script>
        // 初始化图表
        var myChart = echarts.init(document.getElementById('main'));

        // 配置项
        var option = {
            title: {
                text: 'ECharts MarkPoint 示例'
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data: ['销量']
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月']
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                    name: '销量',
                    type: 'line',
                    data: [820, 932, 901, 934, 1290, 1330, 1320],
                    markPoint: {
                        data: [
                            { 
                                type: 'max', 
                                name: '最大值',
                                label: { color: '#ff0000', fontSize: 14 } // 设置文字颜色和字体大小
                            },
                            { 
                                type: 'min', 
                                name: '最小值',
                                label: { color: '#00ff00', fontSize: 14 } // 设置文字颜色和字体大小
                            }
                        ]
                    }
                }
            ]
        };

        // 使用刚指定的配置项和数据显示图表
        myChart.setOption(option);
    </script>
</body>
</html>